package com.stone.base.controller;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;

/**
 * 国际化
 * @author Stone P
 *
 */
@Controller
@RequestMapping("/i18nCtl")
public class I18nController extends BaseController{
	
	@RequestMapping("/language")
    public ModelAndView login(String locale, HttpServletRequest request){
		request.getSession().setAttribute("i18n", locale);
		Locale ll;
		if("en_US".equals(locale)) {
			ll = Locale.ENGLISH;
		} else {
			ll = Locale.CHINA;
		}
		request.getSession().setAttribute(this.I18NLANGUAGE, ll);
		ModelAndView mv = new ModelAndView("index");
		return mv;
	}
}